package com.up360.rapidcalc.aerolite.util
{
    import com.up360.rapidcalc.aerolite.model.Subject;

    /**
     * @author Tunie
     * @date   Apr 28, 2013
     * 题库
     */
    public class Exam extends Collection
    {
        public function Exam()
        {
            super();
        }
        
        /**
         *从题库中随机取得一道试题，并将该试题从题库中删除 
         * @return 
         * 
         */
        public function randomGet():Subject
        {
            if(_length<=0) return null;
            var b_index:int=Math.random()*_length;
            var b_subject:Subject=get(b_index) as Subject;
            remove(b_subject);
            return b_subject;
        }
        
        public function addNoRepeat(obj:Object):void
        {
            if(contain(obj)) return;
            add(obj);
        }
    }
}